import { defHttp } from '@/utils/http/axios';

enum Api {
  USER = '/user',
}

/**
 * @description: user
 */
export function userPageApi(params) {
  return defHttp.get<any>({
    url: Api.USER,
    params,
    headers: {
      // @ts-ignore
      ignoreCancelToken: true,
    },
  });
}

export function userAddApi(params) {
  return defHttp.post<any>(
    {
      url: Api.USER,
      params,
    },
    {
      errorMessageMode: 'none',
    },
  );
}

export function userUpdateApi(params) {
  return defHttp.put<any>(
    {
      url: Api.USER,
      params,
    },
    {
      errorMessageMode: 'none',
    },
  );
}

export function userDeleteApi(params) {
  const { idList } = params;
  return defHttp.delete<any>(
    {
      url: `${Api.USER}?idList=${idList}`,
      params,
    },
    {
      errorMessageMode: 'none',
    },
  );
}
